//
//  THJChartViewCell.m
//  THJXHW
//
//  Created by 河南德艺 on 2017/9/21.
//  Copyright © 2017年 河南德艺. All rights reserved.
//

#import "THJChartViewCell.h"

@implementation THJChartViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (IBAction)btn1clicked:(id)sender {
    [self.delegate changeMonthBtnclick:1];
    self.lineview.frame = CGRectMake(0, 41, ScreenWidth/3, 2);
}
- (IBAction)btn2clicked:(id)sender {
    [self.delegate changeMonthBtnclick:2];
    self.lineview.frame = CGRectMake(ScreenWidth/3, 41, ScreenWidth/3, 2);
}
- (IBAction)btn3clicked:(id)sender {
    [self.delegate changeMonthBtnclick:3];
    self.lineview.frame = CGRectMake(ScreenWidth/3*2, 41, ScreenWidth/3, 2);
}
-(void)setchartViewData:(NSArray*)dataArr DateArr:(NSArray*)dateArr highPrice:(NSInteger)hp lowPrice:(NSInteger)lp{
    NSMutableArray * numArr = [NSMutableArray array];
    NSInteger no1 = 0;
    NSInteger no2 = 999999;
    for (NSString* i in dataArr){
        NSInteger price = [i integerValue];
        NSNumber * num = [NSNumber numberWithInteger:price];
        [numArr addObject:num];
        if(price>no1){
            no1 = price;
        }
        if(price<no2){
            no2 = price;
        }
    }
    NSLog(@"highest--%ld---%ld",hp,lp);
    NSArray * arr1 = [[dataArr reverseObjectEnumerator]allObjects];
    NSArray * arr2 = [[dateArr reverseObjectEnumerator]allObjects];
    [self.chartview setOption:[PYLineDemoOptions basicAreaOption:arr1 DateArr:arr2 HighPrice:@(no1) LowPrice:@(no2)]];
    [self.chartview loadEcharts];
}
@end
